package com.yanjiali.mappers;

import com.yanjiali.entity.Article;
import com.yanjiali.model.req.ArticleUploadReq;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @Package: com.yanjiali.mappers
 * @Author: yanjiali
 * @Created: 2025/4/14 21:17
 * TODO 特别注意：对应类发生了改动需要重新打包
 * 高性能对象的映射转换：
 */
@Mapper(componentModel = "spring")
public interface ArticleUploadReqMapper {

    ArticleUploadReqMapper INSTANCE = Mappers.getMapper(ArticleUploadReqMapper.class);

    /**
     * req ---> entity
     * @param articleUploadReq
     * @return
     */
    Article req2Entity(ArticleUploadReq articleUploadReq);

    /**
     * 批量 req --> entity
     * @param articleUploadReqs
     * @return
     */
    List<Article> reqALL2Entity(List<ArticleUploadReq> articleUploadReqs);
}
